//
//  CYMyFollow_WenDaTableViewCell.m
//  cyydt
//
//  Created by chu on 2019/1/24.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYMyFollow_WenDaTableViewCell.h"

@implementation CYMyFollow_WenDaTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.headImageView.layer.cornerRadius = self.headImageView.frame.size.height / 2;
    self.headImageView.layer.masksToBounds = YES;
}

- (void)setModel:(CYProjectModel *)model{
    _model = model;
    
    if ([model.falg integerValue] == 2) {
        //回答
        [self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.answer_avatar] placeholderImage:[UIImage imageWithColor:[UIColor lightGrayColor] Size:self.headImageView.frame.size]];
        self.nicknameLabel.text = model.answer_nickname;
        self.typeLabel.text = @"回答了问题";
        self.timeLabel.text = model.answerTime;
        self.contentLabel.numberOfLines = 2;
        self.contentLabel.text = [[Tool sharedInstance] delHTMLBiqoQianWithHtml:model.answer_content];
        self.wentiLabel.text = model.title;
        self.zanLabel.text = [NSString stringWithFormat:@"%@点赞", model.like_number];
        self.pinglunLabel.text = [NSString stringWithFormat:@"%@评论", model.comment_number];

        self.marginTop1Constraint.constant = 23;
        self.wentiMarginTopConstraint.constant = 15;
        self.wentiHeightConstraint.constant = 50;
        self.height1Constraint.constant = 34;
        
    }else if ([model.falg integerValue] == 3){
        //评论
        [self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.answer_avatar] placeholderImage:[UIImage imageWithColor:[UIColor lightGrayColor] Size:self.headImageView.frame.size]];

        self.contentLabel.numberOfLines = 0;

        self.nicknameLabel.text = model.answer_nickname;
        self.typeLabel.text = @"评论了";
        self.timeLabel.text = model.answer_time;
        self.contentLabel.numberOfLines = 2;
        self.contentLabel.text = [[Tool sharedInstance] delHTMLBiqoQianWithHtml:model.answer_content];
        self.wentiLabel.text = model.title;
        self.zanLabel.text = [NSString stringWithFormat:@"%@点赞", model.like_number];
        self.pinglunLabel.text = [NSString stringWithFormat:@"%@评论", model.comment_number];
        
        self.marginTop1Constraint.constant = 23;
        self.wentiMarginTopConstraint.constant = 15;
        self.wentiHeightConstraint.constant = 50;
        self.height1Constraint.constant = 34;
    }else{
        [self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageWithColor:[UIColor lightGrayColor] Size:self.headImageView.frame.size]];
        self.contentLabel.numberOfLines = 0;
        self.nicknameLabel.text = model.nickname;
        self.typeLabel.text = @"发布了问题";
        self.timeLabel.text = model.created_time;
        self.contentLabel.text = model.title;
        self.zanLabel.text = [NSString stringWithFormat:@"%@回答", model.answer_number];
        self.marginTop1Constraint.constant = 0;
        self.wentiMarginTopConstraint.constant = 0;
        self.wentiHeightConstraint.constant = 0;
        self.height1Constraint.constant = 0;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
